home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
tcoop10a.zip
/
DEMO.ZIP
/
TESTSTR.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1991-11-20
|
660b
|
31 lines
//
// TESTSTR.CPP
// version 1.00 11/10/91
// tests String CLass
// copyright (c) 1991 by James S. CLark
// all rights reserved
//
#include <stdio.h> // puts()
#include "string.hpp"
main()
{
String s1("Test1"); // create s1
String s2("Test2"); // create s2
String s3 = s1 + s2; // has side effects on s1
// String s4 = s3; // *error* copies the pointer
String s4; // OK
s4 = s3 + "Test4"; // has side effects on s3
s3[3] = 'X';
s3 += " GooGoo";
s3.print();
s4.print();
if (s3 < "Text") puts("less than\n"); // simple enough!
else puts("greater than\n");
}